public class Test6 {
    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread(new Runnable() {
            @Override
            public void run() {
                while (true){
                    System.out.println("---------");
                    System.out.println(Thread.currentThread().getName());
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        },"MY");
        thread.start();
        //thread.join();
        System.out.println("id: "+thread.getId());
        System.out.println("name: " + thread.getName());
        System.out.println("state: " + thread.getState());
        System.out.println("priority: " + thread.getPriority());
        System.out.println("daemon: " + thread.isDaemon());
        System.out.println("alive " + thread.isAlive());
        System.out.println("interrupted: " + thread.isInterrupted());
    }
}
